package com.yusong.test.aop;

import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;

/**
 * Created by yusong on 2017/2/14.
 */
public class RequestBeforeAdvice implements MethodBeforeAdvice {

    private void before(String param) throws Throwable{
        if(!param.equals("yusong"))
            throw new IllegalArgumentException();
    }

    @Override
    public void before(Method method, Object[] args, Object target)
            throws Throwable {
        before((String)args[0]);
    }
}
